package com.sgl.gk.service.impl;

import com.sgl.common.core.controller.BaseController;
import com.sgl.common.utils.ServletUtils;
import com.sgl.gk.domain.GkSettingLog;
import com.sgl.gk.mapper.GkSettingLogMapper;
import com.sgl.gk.service.GkSettingLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author:xuenci
 * @date:2023/2/13 9:58
 **/
@Service
@Slf4j
public class GkSettingLogServiceImpl extends BaseController implements GkSettingLogService {

    @Autowired
    GkSettingLogMapper gkSettingLogMapper;

    @Override
    public List<GkSettingLog> list(GkSettingLog gkSettingLog) {
        if(ServletUtils.getParameter("pageSize")!=null&&ServletUtils.getParameter("pageNum")!=null){
            startPage();
        }
        List<GkSettingLog> gkSettingLogList = gkSettingLogMapper.list(gkSettingLog);
        return gkSettingLogList;
    }

    @Override
    public int add(GkSettingLog gkSettingLog) {
        String username = getUsername();
        gkSettingLog.setUser(username);
        gkSettingLog.setSetTime(new Date());
        int row = gkSettingLogMapper.add(gkSettingLog);
        return row;
    }

    @Override
    public int edit(GkSettingLog gkSettingLog) {
        int row = gkSettingLogMapper.edit(gkSettingLog);
        return row;
    }

    @Override
    public int removeByIds(Long[] ids) {
        int row = gkSettingLogMapper.removeByIds(ids);
        return row;
    }
}
